package com.qf.controller;

import com.qf.bean.SysScene;
import com.qf.dto.R;
import com.qf.service.SysSceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/*
 *  @author Administrator
 *  @version V1.0
 *  @Project smartdeviceplatgorm
 *  @Package com.qf.controller
 *  @Description
 *  @Date2022/3/21 0021 19:30
 */
@RestController
@RequestMapping("/scene")
public class SysSceneController {
    private SysSceneService sysSceneService;
    @Autowired
    public void setSysSceneService(SysSceneService sysSceneService) {
        this.sysSceneService = sysSceneService;
    }
    @PostMapping("/add")
    public R addScene(@RequestBody SysScene sysScene){
        sysSceneService.addSysScene(sysScene);
        return R.setOk();
    }

    @GetMapping("/scene/{id}")
    public R findById(@PathVariable Integer id) {
        return R.setOk(sysSceneService.findById(id));
    }
    @GetMapping("/scenes")
    public R findBySelf(@PathVariable Integer id) {
        return R.setOk(sysSceneService.findById(id));
    }

}
